<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>物流管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">

    <link href="layui/css/layui.css" rel="stylesheet">
    <link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon">
</head>

<body>
<div class="layui-layout layui-layout-admin">

    <div class="layui-header">
        <div class="layui-logo layui-bg-black">
            物流管理系统
        </div>
        <!-- 头部区域（可配合layui 已有的水平导航） -->
        <div style="margin-left: 220px;margin-top: 18px;color: rgba(255,255,255,0.72)">
            尊敬的用户，欢迎您进入物流管理系统！
        </div>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-sm-inline-block">
                <a href="javascript:;">
                    <img id="avatar" src="/admin/getAvatar"
                         class="layui-nav-img">
                    <span id="name">未知用户</span>
                </a>
                <dl class="layui-nav-child">
                    <dd>
                        <a href="javascript:window.location.hash = 'personal_center';$('#main').load('personal_center.html', ()=>{ layui.element.init(); });void(0);"><i class="layui-icon layui-icon-friends">&nbsp;个人中心</i></a>
                    </dd>
                    <dd><a href="javascript:;"><i class="layui-icon layui-icon-set-fill">&nbsp;系统设置</i></a></dd>
                    <dd><a id="exit" href="javascript:;"><i class="layui-icon layui-icon-logout">&nbsp;退出登录</i></a></dd>
                </dl>
            </li>
        </ul>
    </div>
    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item"><a
                        href="javascript:window.location.hash = 'system_index';$('#main').load('system_index.html', ()=>{ layui.element.init(); });void(0);"><i class="layui-icon layui-icon-home" style="margin-left: 0">&nbsp;主页</i></a>
                </li>
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;"><i class="layui-icon layui-icon-username">&nbsp;用户管理</i></a>
                    <dl class="layui-nav-child">
                        <dd class="layui-this">
                            <a href="javascript:window.location.hash = 'staff_management';$('#main').load('staff_management.html', ()=>{ layui.element.init(); });void(0);">员工管理</a>
                        </dd>
                        <dd>
                            <a href="javascript:window.location.hash = 'department_settings';$('#main').load('department_settings.html', ()=>{ layui.element.init(); });void(0);">部门设置</a>
                        </dd>
                        <dd>
                            <a href="javascript:window.location.hash = 'role_permissions';$('#main').load('role_permissions.html', ()=>{ layui.element.init(); });void(0);">角色权限</a>
                        </dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon layui-icon-flag">&nbsp;车辆管理</i></a>
                    <dl class="layui-nav-child">
                        <dd>
                            <a href="javascript:window.location.hash = 'list_of_vehicles';$('#main').load('list_of_vehicles.html', ()=>{ layui.element.init(); });void(0);">车辆列表</a>
                        </dd>
                        <dd>
                            <a href="javascript:window.location.hash = 'vehicle_insurance';$('#main').load('vehicle_insurance.html', ()=>{ layui.element.init(); });void(0);">车辆保险</a>
                        </dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon layui-icon-read">&nbsp;计划管理</i></a>
                    <dl class="layui-nav-child">
                        <dd>
                            <a href="javascript:window.location.hash = 'plan_list';$('#main').load('plan_list.html', ()=>{ layui.element.init(); });void(0);">计划列表</a>
                        </dd>
                        <dd><a href="javascript:;">备品计划</a></dd>
                        <dd><a href="javascript:;">新品/林措</a></dd>
                        <dd><a href="javascript:;">电缆2计划</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon layui-icon-cart-simple">&nbsp;仓库管理</i></a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;">仓库设置</a></dd>
                        <dd><a href="javascript:;">库位设置</a></dd>
                        <dd><a href="javascript:;">转移记录</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon layui-icon-rate-solid">&nbsp;库存管理</i></a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;">物料管理</a></dd>
                        <dd><a href="javascript:;">库存查询</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon layui-icon-rmb">&nbsp;财务管理</i></a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;">出入库台账</a></dd>
                        <dd><a href="javascript:;">计划结算</a></dd>
                        <dd><a href="javascript:;">年度出入台账</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon layui-icon-form">&nbsp;报表统计</i></a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;">出车统计</a></dd>
                        <dd><a href="javascript:;">变电统计</a></dd>
                        <dd><a href="javascript:;">导线统计</a></dd>
                        <dd><a href="javascript:;">新品统计</a></dd>
                        <dd><a href="javascript:;">电缆统计</a></dd>
                        <dd><a href="javascript:;">物料出入统计</a></dd>
                        <dd><a href="javascript:;">人员任务统计</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon layui-icon-util">&nbsp;系统管理</i></a>
                    <dl class="layui-nav-child">
                        <dd><a href="javascript:;">消息通知</a></dd>
                        <dd><a href="javascript:;">定时任务</a></dd>
                        <dd><a href="javascript:;">菜单管理</a></dd>
                        <dd><a href="javascript:;">数据字典</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item"><a href="/vehicle_missions.html">高仿莆田鞋购买</a></li>
                <li class="layui-nav-item"><a href="https://danchar.top">博客</a></li>
            </ul>
        </div>
    </div>

    <div class="layui-body" id="main">

    </div>

    <div class="layui-footer" style="text-align: center">
        <!-- 底部固定区域 -->
        ©2024 Powered by <a href="https://layui.dev/">Layui</a>
    </div>

</div>

<script src="layui/layui.js" charset="utf-8"></script>
<script src="jquery/jquery-3.6.0.js" charset="utf-8"></script>
<script src="echarts/echarts.min.js" charset="utf-8"></script>
<script src="map/js/china.js" charset="utf-8"></script>

<script>
    window.onload = function () {
        window.location.hash = 'staff_management';
        $('#main').load('staff_management.html', () => {
            layui.element.init();
        })

        $.ajax({
            url: "/admin/getInfo",           // 请求路径
            type: "post",                  // 请求的方式，不区分大小写
            cache: false,                  // 关闭缓存，目的是为了避免部分浏览器缓存加载出错(IE)
            contentType: "application/json;charset=utf-8",
            data: {},
            datatype: "json",        // 返回类型，text文本、html页面、json数据
            success: function (response) {
                // 使用 jQuery 更改 span 元素的文本内容
                $("#name").text(response.data.userName);  // 替换 "新的名字" 为你希望的名字

            },
            error: function (response) {
                layer.msg("获取用户信息失败", {icon: 2});
            }
        });
    }

    $("#exit").on("click", function (event) {
        // Prevent the default behavior of the link (prevent navigating to href)
        event.preventDefault();

        // Perform the logout request to /admin/exit using $.ajax
        $.ajax({
            url: "/admin/exit",
            type: "post",
            success: function (data) {
                window.location.href = "index.html"
            },
            error: function (xhr, status, error) {
                // Handle errors
                console.error("Logout failed: " + error);
            }
        });
    });
</script>

</body>

</html>